package com.yx1996.bean.day02;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

//@Component("car") //最常见的扫描注解  下面是三种分类扫描注解
    //@Repository   dao层
    //@Controller   web层
    @Service  //用于service层
public class Car {
    @Value("玛莎拉蒂")  //属性注入方式一，还可以在set方法上注入（推荐set方法这样会更体现封装的特性）
    private String name;
    @Value("黑色")
    private String color;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    @Override
    public String toString() {
        return "Car{" +
                "name='" + name + '\'' +
                ", color='" + color + '\'' +
                '}';
    }
}
